@section('meta')
    <style>
        body{background-color: #fff;}
        .modal-content{display: unset;}
        .layui-form-label {width: 100px;}
        .layui-input-block {margin-left: 138px;}
        .layui-input, .layui-textarea {width: 86%;}
        .layui-form-select .layui-edge {right: 16%;}
        .layui-form-select dl {min-width: 86%;}
        .new-table {margin: 20px 0;}
        .layui-input.layui-bg-gray {line-height: 38px;}

    </style>
@endsection
@include('Home.User.Common._meta')
<!----  新增： 兼职者  ---->
<div class="modal-content new-table" id="addNew-content2">
    <form class="layui-form modal-client-info" action="" id="form-user" lay-filter="form-user">
        @if(Auth::user()->hasAnyRole(['admin']) || (Auth::user()->type == 1 && (Auth::id()==$obj->assign||Auth::id()==$obj->uid)) || (Auth::user()->type == 1 && $obj->share))
            <div class="modal-func-btns">
                <a href="javascript:;" class="modal-save-btn" onclick="subForm('{{route('position_edit',$obj->id)}}')" title="保存"><i class="icon icon-save"></i></a>
                <a href="javascript:location.replace(location.href);" class="modal-edit-btn" title="重置"><i class="icon icon-edit"></i></a>
            </div>
            @include('Home.User.Common._msg')
        @endif
        <div class="layui-form-item">
            <label class="layui-form-label">招聘时间</label>
            <div class="layui-input-block">
                @if(Auth::user()->hasAnyRole(['admin']) || (Auth::user()->type == 1 && Auth::id()==$obj->uid))
                    <input type="text" name="time" lay-verify="" placeholder="请输入招聘时间" autocomplete="off" value="{{$obj->time}}" class="layui-input">
                @else
                    <div class="layui-input layui-bg-gray">{{$obj->time}}</div>
                @endif
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="red">*</span>紧急程度</label>
            <div class="layui-input-block">
                @if(Auth::user()->hasAnyRole(['admin']) || (Auth::user()->type == 1 && Auth::id()==$obj->uid))
                    <select name="emergency" lay-search>
                        <option value="" @if(!$obj->emergency) selected @endif>未选择</option>
                        <option value="1" @if($obj->emergency == 1) selected @endif>紧急重要，优质客户</option>
                        <option value="2" @if($obj->emergency == 2) selected @endif>紧急不重要，一般客户</option>
                        <option value="3" @if($obj->emergency == 3) selected @endif>不紧急不重要，新客户</option>
                    </select>
                @else
                    <div class="layui-input layui-bg-gray">
                        @switch($obj->emergency)
                            @case(1)
                            紧急重要，优质客户
                            @break
                            @case(2)
                            紧急不重要，一般客户
                            @break
                            @case(3)
                            不紧急不重要，新客户
                            @break
                        @endswitch
                    </div>
                @endif
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="red">*</span>所属客户</label>
            <div class="layui-input-block">
                @if(Auth::user()->hasAnyRole(['admin']) || (Auth::user()->type == 1 && Auth::id()==$obj->uid))
                    <select name="client_id" lay-search>
                        <option value="">未选择</option>
                        @foreach($client as $item)
                            <option value="{{$item->id}}" @if($obj->client_id == $item->id) selected @endif>{{$item->chinese_name}}</option>
                        @endforeach
                    </select>
                @else
                    <div class="layui-input layui-bg-gray">{{$obj->client?$obj->client->chinese_name:''}}</div>
                @endif
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="red">*</span>需求状态</label>
            <div class="layui-input-block">
                @if(Auth::user()->hasAnyRole(['admin']) || (Auth::user()->type == 1 && (Auth::id()==$obj->uid || Auth::id()==$obj->assign)))
                    <select id="state" name="state">
                        <option value="0" @if($obj->state == 0) selected @endif>closed</option>
                        <option value="1" @if($obj->state == 1) selected @endif>招聘中</option>
                    </select>
                @else
                    <div class="layui-input layui-bg-gray">
                        @switch($obj->state)
                            @case(0)
                            closed
                            @break
                            @case(1)
                            招聘中
                            @break
                            @default
                            closed
                        @endswitch
                    </div>
                @endif
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="red">*</span>职位名称</label>
            <div class="layui-input-block">
                @if(Auth::user()->hasAnyRole(['admin']) || (Auth::user()->type == 1 && Auth::id()==$obj->uid))
                    <input type="text" name="title" lay-verify="required" placeholder="请输入职位" value="{{$obj->title}}" autocomplete="off" class="layui-input">
                @else
                    <div class="layui-input layui-bg-gray">{{$obj->title}}</div>
                @endif
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="red">*</span>工作地点</label>
            <div class="layui-input-block">
                @if(Auth::user()->hasAnyRole(['admin']) || (Auth::user()->type == 1 && Auth::id()==$obj->uid))
                    <select id="region" name="region" lay-search>
                        <option value="0" disabled selected>请选择</option>
                        @foreach($country as $k => $v)
                            <option value="{{$k}}" @if($obj->region == $k) selected @endif>{{$v['name']}}</option>
                        @endforeach
                    </select>
                @else
                    <div class="layui-input layui-bg-gray">
                        @foreach($country as $k => $v)
                            @if($obj->region == $k)
                                {{$v['name']}}
                            @endif
                        @endforeach
                    </div>
                @endif
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="red">*</span>薪资范围</label>
            <div class="layui-input-block">
                @if(Auth::user()->hasAnyRole(['admin']) || (Auth::user()->type == 1 && Auth::id()==$obj->uid))
                    <select id="range" name="range">
                        <option value="0" disabled selected>请选择</option>
                        @foreach($working_salary as $k => $v)
                            <option value="{{$k}}" @if($obj->range == $k) selected @endif>{{$v['name']}}</option>
                        @endforeach
                    </select>
                @else
                    <div class="layui-input layui-bg-gray">
                        @foreach($working_salary as $k => $v)
                            @if($obj->range == $k)
                                {{$v['name']}}
                            @endif
                        @endforeach
                    </div>
                @endif
            </div>
        </div>
        {{--
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="red">*</span>职位类别</label>
            <div class="layui-input-block">
                @if(Auth::user()->hasAnyRole(['admin']) || (Auth::user()->type == 1 && Auth::id()==$obj->uid))
                    <select id="category" name="category" lay-search>
                        <option value="0" disabled>请选择</option>
                        @foreach($position_class as $parent1)
                            <optgroup label="{{$parent1->name}}">
                                @foreach($parent1->member as $parent2)
                                    <optgroup label="└― {{$parent2->name}}">
                                        @foreach($parent2->member as $class)
                                            <option value="{{$class->id}}" @if($obj->category == $class->id) selected @endif>&emsp;└―└― {{$class->name}}</option>
                                        @endforeach
                                    </optgroup>
                                @endforeach
                            </optgroup>
                        @endforeach
                    </select>
                @else
                    <div class="layui-input layui-bg-gray">
                        @foreach($position_class as $parent1)
                            @foreach($parent1->member as $parent2)
                                @foreach($parent2->member as $class)
                                    @if($obj->category == $class->id)
                                        {{$class->name}}
                                    @endif
                                @endforeach
                            @endforeach
                        @endforeach
                    </div>
                @endif
            </div>
        </div>
        --}}
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="red">*</span>HC</label>
            <div class="layui-input-block">
                @if(Auth::user()->hasAnyRole(['admin']) || (Auth::user()->type == 1 && Auth::id()==$obj->uid))
                    <input type="text" name="hc" lay-verify="required" placeholder="请输入" value="{{$obj->hc}}" autocomplete="off" class="layui-input">@else
                    <div class="layui-input layui-bg-gray">{{$obj->hc}}</div>
                @endif
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">职位要求</label>
            <div class="layui-input-block">
                @if(Auth::user()->hasAnyRole(['admin']) || (Auth::user()->type == 1 && Auth::id()==$obj->uid))
                    <textarea name="demand" placeholder="请输入内容" class="layui-textarea">{{$obj->demand}}</textarea>
                @else
                    <div class="layui-textarea layui-bg-gray"><pre>{{$obj->demand}}</pre></div>
                @endif
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">悬赏金</label>
            <div class="layui-input-block">
                @if(Auth::user()->hasAnyRole(['admin']) || (Auth::user()->type == 1 && Auth::id()==$obj->uid))
                    <input type="text" name="reward" lay-verify="required" placeholder="请输入悬赏金" value="{{$obj->reward}}" autocomplete="off" class="layui-input">
                @else
                    <div class="layui-input layui-bg-gray">{{$obj->reward}}</div>
                @endif
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">创建人</label>
            <div class="layui-input-block">
                <div class="layui-input layui-bg-gray">{{$obj->user->username}}</div>
            </div>
        </div>
        @if(Auth::user()->hasAnyRole(['admin']) || Auth::id()==$obj->assign || $obj->share)
            <div class="layui-form-item">
                <label class="layui-form-label">指定任务归属于</label>
                <div class="layui-input-block">
                    <label for="shareTo">
                        <input type="radio" lay-filter="shareTo" id="shareTo1" name="shareTo" value="1" title="私有" @if($obj->shareTo == 1) checked @endif>
                    </label>
                    <label for="shareTo">
                        <input type="radio" lay-filter="shareTo" id="shareTo2" name="shareTo" value="2"  title="共享全员" @if($obj->shareTo == 2) checked @endif>
                    </label>
                    <label for="shareTo" class="no-margin">
                        <input type="radio" lay-filter="shareTo" id="shareTo3" name="shareTo" title="指派给" value="3" @if($obj->shareTo == 3) checked @endif>
                        <div class="layui-inline">
                            <div class="layui-input-inline" style="width: 160px;">
                                <select lay-filter="assign" id="assign" name="assign">
                                    <option value="0" disabled @if($obj->share || $obj->shareTo == 1 || $obj->shareTo == 2) selected @endif>请选择</option>
                                    @foreach($frame as $item)
                                        @foreach($item as $leader)
                                            <optgroup label="{{$leader->user->username}}">
                                                <option value="{{$leader->uid}}" @if($obj->assign == $leader->uid) selected @endif>{{$leader->user->username}}</option>
                                                @foreach($leader->member as $v)
                                                    <option value="{{$v->uid}}" @if($obj->assign == $v->uid) selected @endif>{{$v->user->username}}</option>
                                                @endforeach
                                            </optgroup>
                                        @endforeach
                                    @endforeach
                                </select>
                            </div>
                        </div>
                    </label>
                </div>
            </div>
        @endif
    </form>
</div>
@section('footer')
    @include('Home.User.Common._assign')
@endsection
@include('Home.User.Common._footer')
@include('Home.User.Common._form')